import axios from '@/utils/request';
import { BASE_URL } from '@/api';

//登录接口
export const login = (params) => {
	return axios.post(`${BASE_URL}/login`, params);
};

//登出接口
export const logout = () => {
	return axios.post(`${BASE_URL}/logout`);
};

export const changePass = (params) => {
	return axios.put(`${BASE_URL}/changePass`, params);
};

export const getPermissions = () => {
	return axios.get(`${BASE_URL}/getPermissions`);
};

export const userList = (params) => {
	return axios.get(`${BASE_URL}/user/list`, { params: params });
};

export const register = (params) => {
	return axios.post(`${BASE_URL}/register`, params);
};

export const editUser = (params) => {
	return axios.put(`${BASE_URL}/user`, params);
};

export const remove = (id) => {
	return axios.delete(`${BASE_URL}/user`, { params: { id: id } });
};

export const roleUser = (params) => {
	return axios.put(`${BASE_URL}/role/user`, {}, { params: params });
};

export const roleUserList = (params) => {
	return axios.get(`${BASE_URL}/role/user`, { params: params });
};
